#include "events.h"


void __stdcall EventListener::Command(ICommand* pCommand)
{

}

void __stdcall EventListener::Reply(ICommand* pCommand)
{

}

void __stdcall EventListener::Error(ICommand* pCommand, LONG Number, BSTR Description)
{
	_tprintf(_T("E(%d): %s\n"), pCommand->GetId(), (LPCTSTR)pCommand->GetReply());
}

void __stdcall EventListener::AttachmentStatus(TAttachmentStatus Status)
{
	_tprintf(_T("Attachment status %d\n"), Status);
}

void __stdcall EventListener::ConnectionStatus(TConnectionStatus Status)
{
	_tprintf(_T("Connection status %d\n"), Status);
}

void __stdcall EventListener::UserStatus(TUserStatus Status)
{
	_tprintf(_T("User status %d\n"), Status);
}

void __stdcall EventListener::OnlineStatus(IUser* pUser, TOnlineStatus Status)
{
	_tprintf(_T("User %s status %d\n"), (LPCTSTR)pUser->GetHandle(), Status);
}

void __stdcall EventListener::CallStatus(ICall* pCall, TCallStatus Status)
{
	_tprintf(_T("Call %d status %d\n"), pCall->GetId(), Status);
}

void __stdcall EventListener::CallHistory()
{
	_tprintf(_T("Call history changed\n"));
}

void __stdcall EventListener::Mute(VARIANT_BOOL Status)
{      
	if (Status == VARIANT_TRUE)
	{
		_tprintf(_T("Mute on\n"));
	} 
	else
	{
		_tprintf(_T("Mute off\n"));
	}
}

void /*__stdcall*/ EventListener::MessageStatus(IChatMessage* pMessage, TChatMessageStatus Status)
{
	if (pMessage)
	{
		MyOutputDebugString("Message id = %d, status %d", pMessage->GetId(), Status);
		_bstr_t body = pMessage->GetBody();
		MyOutputDebugString("	body - %s", (LPCTSTR)body);	
	}
}

void __stdcall EventListener::MessageHistory(BSTR Username)
{
	_tprintf(_T("Message history changed %s\n"), (LPCTSTR)_bstr_t(Username));
}